package com.league.zjxn.jetpack.repository

import com.league.zjxn.app.SPSConstance
import com.league.zjxn.base.BaseManager
import com.league.zjxn.entity.HomeDataResponse
import com.league.zjxn.entity.IndustryListResponse
import com.league.zjxn.entity.ProjectDataResponse
import com.league.zjxn.entity.RegionListResponse
import rxhttp.RxHttp
import rxhttp.await

open class ProjectRepository : BaseManager() {

    suspend fun projectList(
        province_id: String? = null,
        city_id: String? = null,
        title: String? = null
    ): ProjectDataResponse {

       val http = RxHttp.get("/api/project/getProjectListApp")
            .addHeader("token", SPSConstance.token?:"")
        if (!province_id.isNullOrEmpty()){
            http.add("province_id",province_id)
        }
        if (!city_id.isNullOrEmpty()){
            http.add("city_id",city_id)
        }
        if (!title.isNullOrEmpty()){
            http.add("title",title)
        }
        return http.await()
    }


    suspend fun userRegionList(): RegionListResponse =
        RxHttp.get("/api/getArea")
            .addHeader("token", SPSConstance.token ?: "")
            .add("type", "1")
            .await()
}